function spin1(arr) {
    
    //深拷贝保存原来的数组
    let oldArr = [];
    for (let i = 0; i < arr.length; i++) {
        let [...arr1] = arr[i];
        oldArr.push(arr1);
    }
    console.log(arr);
    let length = oldArr.length - 1;
    for (let i = 0; i <= length; i++) {
        for (let j = 0; j <= length; j++) {
            arr[j][length - i] = oldArr[i][j];
        }

    }
    console.log(arr);
    return arr;
}

spin1([
    [1, 2, 3,'r'],
    [4, 5, 6,'t'],
    [7, 8, 9,'w'],
    ['b', 'a', 'n','g']
])